package com.xz.courseschedule.config;

import com.xz.courseschedule.Interceptors.JWTInterceptors;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: zys
 * @CreateTime: 2025-05-30
 */


@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptors())
                .addPathPatterns("/**")  // 其他接口token验证
                .excludePathPatterns("/user/login")
                .excludePathPatterns("/downloadClass")
                .excludePathPatterns("/downloadRoom")
                .excludePathPatterns("/downloadTask")
                .excludePathPatterns("/uploadTask")
                .excludePathPatterns("/uploadClass")
                .excludePathPatterns("/uploadRoom")
                .excludePathPatterns("/chat/ask")
                .excludePathPatterns("/swagger-ui/**")
                .excludePathPatterns("/v3/api-docs/**")
                .excludePathPatterns("/swagger-resources/**")
                .excludePathPatterns("/webjars/**")
                .excludePathPatterns("/swagger-config");
    }
}

